/****************************
Syntax to create/obtain estimates for 
Tables OD1-OD5
*******************************/

clear
cd "C:\Users\Joshua\OneDrive\Documents\Work - Finished\BJPS - Comp Explanations\Dataverse"
use exp3_cleaned.dta
set more off

/*************
Table OD1
***************/

*Gun Control: Agree = support stronger restrictions
tab q15

*Tax Cut: -1 = opppose Trump tax cut, +1 = support, 0 = no attitude
tab taxcuts_3

*Co-Partisanship
tab1 corker_partisan gil_partisan

*Prior Attitude
tab1 corker_pre gil_pre


/*************
Table OD2-OD3
***************/

***Table OD2: Motive Attributions, Bob Corker Means
label def tr 1 "No Justification" 2 "Justification" 3 "Just w/LC" 4 "Just w/RW"
label values corker_exp tr

***All
*Positive Motives
mean corker_pos_fac, over(corker_exp)
anova corker_pos_fac corker_exp

*Negative Motives
mean corker_neg_fac, over(corker_exp)
anova corker_neg_fac corker_exp

***Co-Partisans
*Positive Motives
mean corker_pos_fac if corker_partisan == 1, over(corker_exp)
anova corker_pos_fac corker_exp if corker_partisan == 1

*Negative Motives
mean corker_neg_fac if corker_partisan == 1, over(corker_exp)
anova corker_neg_fac corker_exp if corker_partisan == 1

***Opposing
*Positive Motives
mean corker_pos_fac if corker_partisan == 2, over(corker_exp)
anova corker_pos_fac corker_exp if corker_partisan == 2

*Negative Motives
mean corker_neg_fac if corker_partisan == 2, over(corker_exp)
anova corker_neg_fac corker_exp if corker_partisan == 2


***Table OD3: Motive Attributions, Corker, OLS
eststo clear
eststo: regress corker_neg_fac i.corker_exp i.corker_pre i.corker_prox i.corker_partisan i.treat_order
eststo: regress corker_pos_fac i.corker_exp i.corker_pre i.corker_prox i.corker_partisan i.treat_order
eststo: regress corker_neg_fac i.corker_exp i.corker_pre i.corker_prox i.treat_order if corker_partisan == 1
eststo: regress corker_pos_fac i.corker_exp i.corker_pre i.corker_prox i.treat_order if corker_partisan == 1
eststo: regress corker_neg_fac i.corker_exp i.corker_pre i.corker_prox i.treat_order if corker_partisan == 2
eststo: regress corker_pos_fac i.corker_exp i.corker_pre i.corker_prox i.treat_order if corker_partisan == 2


esttab using "table_od3.rtf", replace onecell label nobaselevels se ar2 star(* 0.05 ** 0.01 *** 0.001) ///
	mtitles("Neg" "Pos" "Neg (Co-P)" "Pos (Co-P)" "Neg (OpP)" "Pos (OpP)") ///
	title("{\b Table OD3:} Experiment 3 Results, Corker Motive Attributions") 

/*************
Table OD4-OD5
***************/

***Table OD4: Motive Attributions, Gillibrand Means
label values gil_exp tr

***All
*Positive Motives
mean gil_pos_fac, over(gil_exp)
anova gil_pos_fac gil_exp

*Negative Motives
mean gil_neg_fac, over(gil_exp)
anova gil_neg_fac gil_exp

***Co-Partisans
*Positive Motives
mean gil_pos_fac if gil_partisan == 1, over(gil_exp)
anova gil_pos_fac gil_exp if gil_partisan == 1

*Negative Motives
mean gil_neg_fac if gil_partisan == 1, over(gil_exp)
anova gil_neg_fac gil_exp if gil_partisan == 1

***Opposing
*Positive Motives
mean gil_pos_fac if gil_partisan == 2, over(gil_exp)
anova gil_pos_fac gil_exp if gil_partisan == 2

*Negative Motives
mean gil_neg_fac if gil_partisan == 2, over(gil_exp)
anova gil_neg_fac gil_exp if gil_partisan == 2


***Table OD3: Motive Attributions, Corker, OLS
eststo clear
eststo: regress gil_neg_fac i.gil_exp i.gil_pre i.gil_prox i.gil_partisan i.treat_order
eststo: regress gil_pos_fac i.gil_exp i.gil_pre i.gil_prox i.gil_partisan i.treat_order
eststo: regress gil_neg_fac i.gil_exp i.gil_pre i.gil_prox i.treat_order if gil_partisan == 1
eststo: regress gil_pos_fac i.gil_exp i.gil_pre i.gil_prox i.treat_order if gil_partisan == 1
eststo: regress gil_neg_fac i.gil_exp i.gil_pre i.gil_prox i.treat_order if gil_partisan == 2
eststo: regress gil_pos_fac i.gil_exp i.gil_pre i.gil_prox i.treat_order if gil_partisan == 2


esttab using "table_od5.rtf", replace onecell label nobaselevels se ar2 star(* 0.05 ** 0.01 *** 0.001) ///
	mtitles("Neg" "Pos" "Neg (Co-P)" "Pos (Co-P)" "Neg (OpP)" "Pos (OpP)") ///
	title("{\b Table OD5:} Experiment 3 Results, Gillibrand Motive Attributions") 



